package com.bio.test2;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
 * 自定义线程池
 * @author gxkj-042
 *
 */
public class HandlerExecutorPool {
	
	private ExecutorService service;
	
	public HandlerExecutorPool(int maxPoolSize,int queueSize) {
		this.service = new ThreadPoolExecutor(
				Runtime.getRuntime().availableProcessors(), 
				maxPoolSize, 
				120L, 
				TimeUnit.SECONDS, 
				new ArrayBlockingQueue<Runnable>(queueSize));
	}
	
	public void execute(Runnable task) {
		this.service.execute(task);
	}
}
